package io.datajek.springbasics.movierecommendersystem.lesson9;

//寻找电影

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("CBF")
public class ContentBasedFilter implements Filter {

    private static int instances= 0;

    @Autowired
    private Movie movie;

    public ContentBasedFilter(Movie movie) {
        super();
        instances++;
        this.movie = movie;
        System.out.println("content-based filter constructor called");
    }

    public Movie getMovie() {
        return movie;
    }

    //寻找相关电影的所有步骤都在这个方法中进行
    public String[] getRecommendations(String movie){

        return new String[] {"Happy Feet", "Ice Age", "Shark Tale"};
    }

    public static int getInstances(){
        return ContentBasedFilter.instances;
    }
}
